package com.annchain.og_browser.exception.handler;

import com.annchain.og_browser.exception.BusinessException;
import com.annchain.og_browser.exception.StatusCode;
import com.annchain.og_browser.vo.JsonResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;

@ControllerAdvice
public class ExceptionHandler {
    @org.springframework.web.bind.annotation.ExceptionHandler(BusinessException.class)
    public JsonResponse handlerException(BusinessException ex) {
        JsonResponse response = new JsonResponse();
        response.setCode(ex.getResponse().getCode());
        response.setMsg(ex.getResponse().getMsg());
        return response;
    }
}
